home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ray Dream Studio
/
Ray Dream Studio (CDRAYD1) (Ray Dream) (1995).iso
/
DREAMSDK.WIN
/
INCLUDE
/
3DCOFAIL.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-11-04
|
2KB
|
106 lines
/* $Id: 3DCOFAIL.CPP 1.2 1995/11/04 14:51:27 YannPC Exp $ */
/*****************************************************************************\
* *
* 3DCoFail.cpp *
* Failure handling for COM extensions *
* *
* Copyright (c) 1995, Ray Dream, Inc. All rights reserved. *
* *
\*****************************************************************************/
#ifndef __3DCOFAIL__
#include "3DCoFail.h"
#endif
#ifndef __I3DSHUTI__
#include "I3DShUti.h"
#endif
#include "String.h"
IShUtilities* gShellUtilities = NULL;
extern "C" {
RDsetjmpProc RDsetjmp;
}
// Initialize gShellUtilities. Must be called to have working failure handling
void InitCoFailure(IShUtilities* shellUtilities) {
gShellUtilities = shellUtilities;
RDsetjmp = (RDsetjmpProc) shellUtilities->GetSetJmpAddress();
}
void FailNIL(void* apointer) {
if (!apointer) {
Failure(-1, 0);
}
}
void FailOSErr(short err) {
if (err) {
Failure(err, 0);
}
}
void __cdecl Failure(short error, long message) {
if (gShellUtilities) {
gShellUtilities->Failure(error, message);
}
}
FailInfoPtr* __cdecl GetGTopHandler() {
if (gShellUtilities) {
return (FailInfoPtr*) gShellUtilities->GetGTopHandler();
}
else {
return NULL;
}
}
void* RDmalloc(unsigned long size) {
if (gShellUtilities) {
return gShellUtilities->Malloc(size);
}
else {
return NULL;
}
}
void* RDcalloc(unsigned long nmemb, unsigned long size) {
if (gShellUtilities) {
return gShellUtilities->Calloc(nmemb, size);
}
else {
return NULL;
}
}
void* RDrealloc(void* ptr, unsigned long size) {
if (gShellUtilities) {
return gShellUtilities->Realloc(ptr, size);
}
else {
return NULL;
}
}
void* RDcrealloc(void* ptr, unsigned long size) {
if (gShellUtilities) {
return gShellUtilities->Crealloc(ptr, size);
}
else {
return NULL;
}
}
void RDfree(void* ptr) {
if (gShellUtilities) {
gShellUtilities->Free(ptr);
}
}
void RDmemmove(void * dstPtr, void const * srcPtr, long size) {
memmove(dstPtr, srcPtr, size);
}